var a = require("../../../utils/api.js"), t = getApp();

Page({
    data: {
        status: 1,
        data: "",
        page: 2,
        page_code: 1
    },
    onLoad: function(e) {
        var o = this;
        a.getFraction_Inter({
            openid: t.globalData.openid
        }).then(function(a) {
            console.log(a), 0 == a.data.status && o.setData({
                data: a.data.data
            });
        }), wx.setNavigationBarColor({
            frontColor: wx.getStorageSync("basic").topcolor,
            backgroundColor: wx.getStorageSync("basic").topbg
        });
    },
    income: function(e) {
        var o = this, n = e.currentTarget.dataset.id;
        this.setData({
            status: n
        }), wx.showLoading({
            title: "加载中"
        }), a.getFraction_Inter({
            openid: t.globalData.openid,
            type: n
        }).then(function(a) {
            console.log(a), 0 == a.data.status && o.setData({
                data: a.data.data,
                page: 2,
                page_code: 1
            }), wx.hideLoading();
        });
    },
    onReachBottom: function(e) {
        var o = this;
        wx.showLoading({
            title: "加载中"
        }), 1 == o.data.page_code && a.getFraction_Inter({
            openid: t.globalData.openid,
            type: o.data.status,
            page: o.data.page
        }).then(function(a) {
            if (0 == a.data.status) {
                var t = o.data.data;
                t = t.concat(a.data.data);
                var e = parseInt(o.data.page) + parseInt(1);
                o.setData({
                    data: t,
                    page: e
                }), "" == a.data.data && o.setData({
                    page_code: 2
                });
            }
        }), wx.hideLoading();
    }
});